# -*- coding: utf-8 -*-
# 拦截器文件样式

from application import app
from flask import request, redirect, g
import re


@app.before_request
def before_request():
    ignore_urls = app.config['IGNORE_URLS']
    ignore_check_login_urls = app.config['IGNORE_CHECK_LOGIN_URLS']
    path = request.path

    # 匹配到得规则，就不拦截
    pattern = re.compile('%s' % "|".join(ignore_check_login_urls))  # 正则表达式匹配，将数组里面的url以“|”连接
    if pattern.match(path):
        return

    # 匹配到得规则，就不拦截
    pattern = re.compile('%s' % "|".join(ignore_urls))  # 正则表达式匹配，将数组里面的url以“|”连接
    if pattern.match(path):
        return

    return




